Skip to content

test: verify api graceful shutdown ordering - #274

Merged
Jagadeeshftw merged 1 commit into
Grainlify:mainfrom
Goodnessoj:test/api-shutdown-ordering
Jul 27, 2026
Merged

test: verify api graceful shutdown ordering#274
Jagadeeshftw merged 1 commit into
Grainlify:mainfrom
Goodnessoj:test/api-shutdown-ordering

Conversation

@Goodnessoj

Copy link
Copy Markdown
Contributor

Closes #161

Summary

  • Extracted the API graceful shutdown sequence into a small testable helper.
  • Documented the intended order: stop HTTP listener first, cancel/wait workers, drain/close bus, close DB last.
  • Added tests for shutdown ordering, DB remaining open until HTTP drain completes, repeated shutdown invocation, dependency close errors, and non-fatal worker wait timeout handling.

Tests

  • go test ./cmd/api/... -v

Notes

  • Existing HTTP shutdown timeout behavior remains delegated to internal/shutdown.Wait for workers and internal/api.Shutdown for Fiber.
  • Current bus and DB close methods do not return errors, but the extracted helper preserves error reporting for close hooks so future close failures are not masked.

@Jagadeeshftw
Jagadeeshftw merged commit 5d73116 into Grainlify:main Jul 27, 2026
@Goodnessoj
Goodnessoj deleted the test/api-shutdown-ordering branch July 28, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add graceful-shutdown ordering test for cmd/api/main.go

2 participants